import unittest
import requests
from api.login import LoginAPI
import json


class TestLogin(unittest.TestCase):
    def setUp(self):
        self.session = requests.session()
        self.loginAPI = LoginAPI()

    def tearDown(self):
        self.session.close()

    def test01_login_succsess(self):
        response = self.loginAPI.verify(self.session)
        print(response)
        self.assertEqual(200, response.status_code)
        self.assertIn("image", response.headers.get("Content-Type"))
        response = self.loginAPI.login(session=self.session,
                                       username="14400000000",
                                       password="123456",
                                       verify_code="8888")
        print(response.json())
